#ifndef __ASSERT_H
#define __ASSERT_H
#include "mxsetup.h"

extern void consoleline (const char *fmt, ...);

#ifdef MXSETUP_USE_ASSERT
#define assert_true(cond) { \
    if (!(cond)) {    \
        consoleline("[ASSERTED] in file: %s:%d", __FILE__, __LINE__);    \
        consoleline("           "#cond);     \
        while (mx_true) { /* block here */ }    \
    }   \
}
#define assert_false(cond) { \
    if ((cond)) {    \
        consoleline("[ASSERTED] in file: %s:%d", __FILE__, __LINE__);    \
        consoleline("           "#cond);     \
        while (mx_true) { /* block here */ }    \
    }   \
}
#else
#define assert_true(cond) { /* do nothing */ }
#define assert_false(cond) { /* do nothing */ }
#endif  /* MXSETUP_USE_ASSERT */

#define assert(cond) assert_false(cond)

#endif
